package models

//UserInfo 用户信息表
type UserInfo struct {
	ID      int64  `json:"id" xorm:"'id' pk autoincr BIGINT(20)"`
	UserID  int64  `json:"user_id" xorm:"'user_id' BIGINT(20)"`
	Key     string `json:"key" xorm:"'key' VARCHAR(256)"`
	Value   string `json:"value" xorm:"'value' text"`
	Created Time   `json:"created" xorm:"'created' TIMESTAMP created DEFAULT CURRENT_TIMESTAMP"`
	Updated Time   `json:"updated" xorm:"'updated' TIMESTAMP updated DEFAULT CURRENT_TIMESTAMP"`
	Version int64  `json:"version" xorm:"'version' BIGINT(20) version"`
}

type UserInfoDAO interface {
	GetUserInfo(userID int, limit int, start int) (userInfo []*UserInfo, err error)
}

//GetUserInfo 根据用户id获取用户全部信息
func (db *dBSession) GetUserInfo(userID int, limit int, start int) (userInfo []*UserInfo, err error) {
	err = db.Where("user_id=?", userID).Limit(limit, start).Find(&userInfo)
	return
}
